<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script>
        function isOdd(n) {
            if (n % 2 === 0) {
                return false; // 返回false
            }
            return true; // 返回true
        }

        var nums = [234, 45, 65, 76, 3, 7, 76, 2342];

        var sum = 0;
        for (var i = 0; i < nums.length; i++) {
            if (isOdd(nums[i])) {
                sum += nums[i];
            }
        }
        console.log(sum);
    </script>
</body>

</html>
